﻿@using LdCms.EF.DbModels
@using LdCms.Common.Utility
@using LdCms.Common.Extension
@model Ld_Service_MessageBoard
@{
    ViewData["Title"] = "Show";
    Layout = "~/Views/Shared/_Layout.cshtml";
}

<article class="page-container">
    <div>
        <div style="height:32px;line-height:32px;">基本信息：</div>
        <table class="table table-border table-bordered table-hover table-bg table-sort">
            <tbody>
                <tr>
                    <td class="text-r" style="background-color:#f5fafe;" width="200">留言ID：</td>
                    <td class="text-l" width="" colspan="3">@Model.MessageID</td>
                </tr>
                <tr>
                    <td class="text-r" style="background-color:#f5fafe;" width="200">公司名称：</td>
                    <td class="text-l" width="35%">@Model.CompanyName</td>
                    <td class="text-r" style="background-color:#f5fafe;" width="200">联系人：</td>
                    <td class="text-l" width="">@Model.Name</td>
                </tr>
                <tr>
                    <td class="text-r" style="background-color:#f5fafe;" width="200">联系电话：</td>
                    <td class="text-l" width="">@Model.Tel</td>
                    <td class="text-r" style="background-color:#f5fafe;" width="200">联系手机：</td>
                    <td class="text-l" width="">@Model.Phone</td>
                </tr>
                <tr>
                    <td class="text-r" style="background-color:#f5fafe;" width="200">邮箱地址：</td>
                    <td class="text-l" width="">@Model.Email</td>
                    <td class="text-r" style="background-color:#f5fafe;" width="200">IP地址：</td>
                    <td class="text-l" width="">@Model.IpAddress</td>
                </tr>
                <tr>
                    <td class="text-r" style="background-color:#f5fafe;" width="200">审阅状态：</td>
                    <td class="text-l" width="">@Model.State</td>
                    <td class="text-r" style="background-color:#f5fafe;" width="200">置顶状态：</td>
                    <td class="text-l" width="">@Model.IsTop</td>
                </tr>
                <tr>
                    <td class="text-r" style="background-color:#f5fafe;" width="200">留言内容：</td>
                    <td class="text-l" width="" colspan="3">@Model.Content</td>
                </tr>
                <tr>
                    <td class="text-r" style="background-color:#f5fafe;" width="200">留言时间：</td>
                    <td class="text-l" width="" colspan="3">@Model.CreateDate</td>
                </tr>
            </tbody>
        </table>
        <div style="height:32px;line-height:32px;">回复信息：</div>
        <table class="table table-border table-bordered table-hover table-bg table-sort">
            <tbody>
                <tr>
                    <td class="text-r" style="background-color:#f5fafe;" width="200">回复内容：</td>
                    <td class="text-l" width="" colspan="3">@Model.Reply</td>
                </tr>
                <tr>
                    <td class="text-r" style="background-color:#f5fafe;" width="200">员工工号：</td>
                    <td class="text-l" width="35%">@Model.ReplyStaffId</td>
                    <td class="text-r" style="background-color:#f5fafe;" width="200">员工姓名：</td>
                    <td class="text-l" width="">@Model.ReplyStaffName</td>
                </tr>
                <tr>
                    <td class="text-r" style="background-color:#f5fafe;" width="200">回复时间：</td>
                    <td class="text-l" width="" colspan="3">@Model.ReplyTime</td>
                </tr>
            </tbody>
        </table>
        <div style="height:32px;line-height:32px;">操作信息：</div>
        <table class="table table-border table-bordered table-hover table-bg table-sort">
            <tbody>
                <tr>
                    <td class="text-r" style="background-color:#f5fafe;" width="200">回复：</td>
                    <td class="text-l" width="">
                        <textarea id="fReply" name="fReply" class="textarea" placeholder="说点什么...100个字符以内" dragonfly="true"></textarea>
                        <p class="textarea-numberbar"><em class="textarea-length">0</em>/100</p>
                    </td>
                </tr>
                <tr>
                    <td class="text-r" style="background-color:#f5fafe;" width="200">审阅：</td>
                    <td class="text-l" width="">
                        <div class="check-box">
                            <input type="checkbox" id="fState" name="fState" value="1" @(Model.State.ToBool() ? "checked" : "") />
                            <label for="checkbox-1">&nbsp;</label>
                        </div>
                    </td>
                </tr>
                <tr>
                    <td class="text-r" style="background-color:#f5fafe;" width="200"></td>
                    <td class="text-l" width="">
                        <a class="btn btn-primary radius" onclick="$.mainu.updateReply()">提交</a>
                    </td>
                </tr>
            </tbody>
        </table>


    </div>
    <div class="pt-30" style="width:100%; height:60px;"></div>
</article>
@*
    --------------
    页面底部JS脚本
    --------------
*@
@section scripts{
    <!--请在下方写此页面业务相关的脚本-->
    <script type="text/javascript" src="~/admin/lib/jquery.validation/1.14.0/jquery.validate.js"></script>
    <script type="text/javascript" src="~/admin/lib/jquery.validation/1.14.0/validate-methods.js"></script>
    <script type="text/javascript" src="~/admin/lib/jquery.validation/1.14.0/messages_zh.js"></script>
    <script type="text/javascript">
        (function ($) {
            $.mainu = {
                init: function () {
                    $('.check-box input').iCheck({
                        checkboxClass: 'icheckbox-blue',
                        radioClass: 'iradio-blue',
                        increaseArea: '20%'
                    });
                    $("#fReply").Huitextarealength({
                        minlength: 4,
                        maxlength: 100
                    });
                },
                updateReply: function () {
                    var fReply = $("textarea[name='fReply']").val();
                    var fState = $("input[name='fState']").is(':checked');
                    if (fReply.length <= 1) {
                        layer.alert("回复内容不能为空！", { icon: 5 });
                        return;
                    }
                    var url = "@Url.Action("UpdateReply", new { MessageID = Model.MessageID })";
                    var data = {
                        fReply: fReply,
                        fState: fState
                    };
                    $.ajax({
                        url: url,
                        type: "POST",
                        cache: false,
                        data: data,
                        success: function (result) {
                            var state = result.state;
                            var message = result.message;
                            if (state == "success") {
                                location.reload();
                            } else {
                                layer.alert(message, { icon: 5 });
                            }
                        }
                    });
                }
            };
            $(function () {
                $.mainu.init();
            });
        })(jQuery);
    </script>
}
